package com.reservationserver.mapper.admin;

import com.reservationpojo.domin.vo.AdminPingpongvo;
import com.reservationpojo.entity.Pingpong;
import com.reservationpojo.entity.shutdowncourt;
import org.apache.ibatis.annotations.*;

import java.time.LocalDateTime;
import java.util.List;

@Mapper
public interface AdminPingpongMapper {

    List<Pingpong> selectreservation(AdminPingpongvo pingpong);

    @Update("update pingpong set status=#{status} where reservation_start_time=#{reservationStartTime} and " +
            "reservation_end_time=#{reservationEndTime} and position=#{position} and reserved_byid=#{reservedByid} and create_time=#{createTime} ")
    void deleteReservation(Pingpong pingpong);

    @Update("update pingpong set status = #{status} where reservation_start_time=#{reservationStartTime} and " +
            "reservation_end_time=#{reservationEndTime} and position=#{position} and reserved_byid=#{reservedByid} and create_time=#{createTime}")
    Pingpong checkReservation(Pingpong pingpong);
    @Insert("insert into shutdowncourt (court,start_time) values (#{courtId},#{starttime})")
    void shutDownCourt(String courtId, LocalDateTime starttime);
    @Delete("delete from shutdowncourt where court=#{courtId}")
    void openCourt(String courtId);
    @Select("select court from shutdowncourt where court like concat('pingpong','%')")
    List<shutdowncourt> checkCourt();
    //设置是否允许重复预约
    @Update("update isrepeate set pingpong =1 where flag= '1'")
    void uprepeate();
}
